<?php

namespace App\Http\Controllers\Api\Home;

use Illuminate\Http\Request;
use App\Http\Controllers\Api\Home\BaseController;
use App\Http\Requests\Message\Store;
use App\Models\Message;

class MessageController extends BaseController
{
    private $return = array(
        'code' => 1,
        'msg' => ''
    );
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function Store(Message $message,Store $request)
    {
        $data = $request->all();
        $result = $message->add_data($data);
        if(!$result){
            $this->return['msg'] = '操作失败！';
        }else{
            $this->return['code'] = 0;
            $this->return['msg'] = '感谢您的留言，我们将尽快答复您~';
        }
        return response()->json($this->return);
    }

}
